<template>
  <div id="Addtion">
<!--    <h1>当前最新的count值是:{{$store.state.count}}</h1>-->
<!--    访问getter的第一种方法-->
    <h1>{{this.$store.getters.showNum}}</h1>
    <button @click="bindHander">+1</button>
    <button @click="bindHander2">+2</button>
    <button @click="bindHander3">+1 Async</button>
    <button @click="bindHander4">+N Async</button>
  </div>
</template>

<script>
export default {
name:'Addtion',
methods: {
    bindHander(){
        this.$store.commit('add')
    },
    bindHander2(){
        this.$store.commit('add2',2)
    },
    // 异步
    bindHander3(){
        this.$store.dispatch('AddAsync')
    },
  bindHander4(){
  this.$store.dispatch('AddNasync',5)
  }
},
}
</script>

<style>

</style>